package org.community.loginsvc.controller;


import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


//异常处理控制器
@ControllerAdvice
public class ErrorController {


//    //未登录跳转视图
//    @ExceptionHandler(NotLoginException.class)
//    public String toLoginPage(Model model){
//        model.addAttribute("status","尚未登录或者会话已过时");
//        return "login";
//    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String handle(Exception e, Model model) {
        return "出现了一些错误，错误信息：" +
                ""+e.getMessage();
    }


}
